{extend name="common/base" /}
{block name="body"}
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
    <ul class="layui-tab-title">
        <li {eq name="$status" value="0"} class="layui-this" {/eq} ><a href="{:url('getMsgList',['status'=>0])}">未读消息</a></li>
        <li {eq name="$status" value="1"} class="layui-this" {/eq}><a href="{:url('getMsgList',['status'=>1])}">已读消息</a></li>
    </ul>
    <div class="layui-tab-content"></div>
</div>
<div class="layui-form" style="padding:0px 10px 0px 10px;">
    <table class="layui-table" lay-even="" lay-skin="nob">
        <colgroup>
            <col width="50">
            <col width="">
            <col width="180">
            <col width="150">
            <col>
        </colgroup>
        <thead>
        <tr>
            <th><input name="" lay-skin="primary" lay-filter="allChoose" type="checkbox"></th>
            <th>用户</th>
            <th>消息时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="msgList" id="vo"}
        <tr>
            <td><input name="" lay-skin="primary" type="checkbox"></td>
            <td>
                <div class="layui-row rha-mp-msg ">
                    <div class="mp-msg-headimg layui-col-md1"><img src="{$vo.avatarurl}"></div>
                    <div class="mp-msg-info layui-col-md10" style="overflow: hidden;height: 60px;">
                        <p>
                            <span style="padding: 0px 0px 0px 5px;">{$vo.nickname}</span>
                            {eq name="$status" value ="0"}
                            <span class="msg_total show">{$vo.msg_total}</span>
                            {else/}
                            <span style="font-size: 10px;">共有{$vo.msg_total}条记录</span>
                            {/eq}</p>
                        <p class="mp-msg-content">{$vo.content}</p>
                    </div>
                </div>
            </td>
            <td>{$vo.create_time}</td>
            <td><a class="rha-bt-a" href="{:url('replyMsg',['openid'=>$vo.openid])}">回复消息</a> </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    {$msgList->render()|raw}
</div>
<script>
    layui.use('form', function(){
        var $ = layui.jquery, form = layui.form;
        form.on('checkbox(allChoose)', function(data){
            var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
            child.each(function(index, item){
                item.checked = data.elem.checked;
            });
            form.render('checkbox');
        });
    });
</script>
{/block}